<template>
  <div class="ele-body">
    <key-search @send-key="getKey" />
    <asset-table ref="assetTable" :params="key" @show="openDialog(true)" @edit-asset="edit" />
    <form-dialog
      :is-show="isShow"
      :form-data="formData"
      @close="openDialog(false)"
      @reload-table="reloadTable"
    />
  </div>
</template>

<script>
import keySearch from '../../components/keySearch'
import formDialog from '../components/assetFormDialog'
import assetTable from './table'
export default {
  name: 'AssetList',
  components: {
    assetTable,
    keySearch,
    formDialog
  },
  data() {
    return {
      key: '',
      isShow: false,
      formData: {}
    }
  },
  methods: {
    getKey(value) {
      this.key = value
    },
    openDialog(status) {
      this.isShow = status
    },
    edit(value) {
      this.formData = Object.assign({}, value)
    },
    reloadTable() {
      this.$refs.assetTable.reload()
    }
  }
}
</script>

<style scoped>

</style>
